<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>帖子详情</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="前端社区">
  <meta name="description" content="技术交流社区网站">
  <link rel="stylesheet" href="/static/web/res/layui/css/layui.css">
  <link rel="stylesheet" href="/static/web/res/css/global.css">
</head>
<body>
@extends('Web.common.header')

<div class="layui-hide-xs">
  <div class="fly-panel fly-column">
    <div class="layui-container">
      <ul class="layui-clear">
        <li class="layui-hide-xs"><a href="/">首页</a></li>
        @if($type)
          @foreach($type as $key => $value)
            <li class="{{$data['type_id']==$value['id']?'layui-this':''}}"><a href="/forumList/{{$value['id']}}">{{$value['title']}}</a></li>
          @endforeach
        @endif
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>

        <!-- 用户登入后显示 -->
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="/userIndex">我发表的贴</a></li>
        <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="/userIndex#collection">我收藏的贴</a></li>
      </ul>

      <div class="fly-column-right layui-hide-xs">
        {{--<span class="fly-search"><i class="layui-icon"></i></span>--}}
        <a href="/forumCreate" class="layui-btn">发表新帖</a>
      </div>
    </div>
  </div>
</div>

<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8 content detail">
      <div class="fly-panel detail-box">
        <h1>{{$data['title']}}</h1>
        <div class="fly-detail-info">
          @if(!empty($data['user']) && $data['user']['id'] == $data['user_id'] && $data['status'] ==1)
            <span class="layui-badge" style="background-color: #999;">审核中</span>
          @endif
          @if(!empty($data['user']) && $data['user']['id'] == $data['user_id'] && $data['status'] ==2)
              <span class="layui-badge layui-bg-gray">被拒绝</span>
          @endif
          @if($data['is_top']==1)
            <span class="layui-badge layui-bg-black">置顶</span>
          @endif

          {!! $data['tag'] !!}

          {{--<div class="fly-admin-box">--}}
            @if(!empty($data['user']) && $data['user']['id'] == $data['user_id'])
              &nbsp
              <a href="/forumEdit/{{$data['id']}}">
                <span class="layui-badge layui-bg-green" type="edit">编辑</span>
              </a>
              <a id="delete" style="cursor:pointer" data-url="/forumDelete">
                <span class="layui-badge layui-bg-blue" type="del">删除</span>
              </a>
            @endif
          {{--</div>--}}
          <span class="fly-list-nums">
            <a href="#comment" id="comm">
              <i class="iconfont" title="回答">&#xe60c;</i>
              <span id="comTotal">{{$data['get_comment_count']}}</span>
            </a>
            <i class="iconfont" title="人气">&#xe60b;</i> {{$data['views_num']}}
          </span>
        </div>
        <div class="detail-about">
          <a href="/userHome?id={{$data['user_id']}}" class="fly-avatar">
            <img src="{{$data['get_user']['head_img']['url']}}" alt="{{$data['get_user']['name']}}">
          </a>
          <div class="fly-detail-user">
            <a href="/userHome?id={{$data['user_id']}}" class="fly-link">
              <cite>{{$data['get_user']['name']}}</cite>
              @if($data['get_user']['rank'] > 0)
              <i class="iconfont icon-renzheng" title="认证信息："></i>
              <i class="layui-badge fly-badge-vip">VIP{{$data['get_user']['rank']}}</i>
              @endif
            </a>
            <span>{{friendly_date($data['created_at'])}}</span>
          </div>
          <div class="detail-hits">
            <span style="padding-right: 10px; color: #FF7200;display: inline-block;white-space: nowrap;width: 100%;overflow: hidden;text-overflow:ellipsis;">{{$data['get_user']['sign']}}</span>
          </div>
        </div>

        <div class="detail-body photos" style="margin-top: 0px;min-height:100px;">
          {!! $data['content'] !!}
        </div>
      </div>

      <div class="fly-panel detail-box" id="flyReply">
        <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
          <legend>回帖</legend>
        </fieldset>

        <ul class="jieda" id="commentList"></ul>
        <a name="comment"></a>

        @if($data['get_comment_count'] > 10)
        <div style="text-align: center">
          <div id="page"></div>
        </div>
        @endif

        <div class="layui-form layui-form-pane">
          <form data-url="/forumReply">
            {{csrf_field()}}
            <div class="layui-form-item layui-form-text">
              <div class="layui-input-block">
                <textarea name="content" lay-verify="required" placeholder="请输入内容" class="layui-textarea fly-editor"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <span id="heightInput"></span>
              <input type="hidden" name="type" value="1">
              <input type="hidden" name="p_id" value="0">
              <input type="hidden" name="forum_id" value="{{$data['id']}}">
              <button class="layui-btn layui-btn-sm" lay-submit lay-filter="submitIng">提交回复</button>
            </div>
          </form>
        </div>
      </div>
    </div>
    <div class="layui-col-md4">
      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">最近热议</dt>
        @foreach($host as $h)
          <dd>
            <a href="/forumDetail/{{$h['id']}}">{{$h['title']}}</a>
            <span><i class="iconfont icon-pinglun1"></i> {{$h['get_comment_count']}}</span>
          </dd>
        @endforeach
      </dl>

      <div class="fly-panel">
        <div class="fly-panel-title">
          这里可作为广告区域
        </div>
        <div class="fly-panel-main">
          <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">LayIM 3.0 - layui 旗舰之作</a>
        </div>
      </div>

    </div>
  </div>
</div>

@extends('Web.common.footer')

@section('script')
  <script>
    layui.use(['layer', 'jquery', 'fly', 'face'], function () {
      $ = layui.jquery;
      var $ = layui.$ , fly = layui.fly;
      //如果你是采用模版自带的编辑器，你需要开启以下语句来解析。
      $('.detail-body').each(function(){
        var othis = $(this), html = othis.html();
        othis.html(fly.content(html));
      });

    });
  </script>
  @include('Web.jie.js')
@endsection

</body>
</html>
